<?php include_partial("default/tab", array('navbars' => $navbars)) ?>
<?php include_partial("default/submenu", array('submenus' => $submenus)) ?>
<div id="vtns_body" class="clearfix">
	<div class="container-fluid">
	  <div class="row-fluid">
		<div class="span9" id="vtnsApply">
        	<!--BEGIN Body content-->
            <?php
			if ($step == 1)
			{
			?>
            <form class="form-horizontal" method="post" id="applyForm2" action="<?php echo url_for("apply_online") ?>">
                <input type="hidden" name="func" value="applyForm2" />
                <div class="row-fluid">
                    <div class="box vtns-box-blue">
                        <div class="title">
                            <h4><span class="icon16 entypo-icon-info-circle white"></span>Service Information</h4>
                        </div>
                        <div class="content noPad">
                            <table class="responsive table table-striped table-align-left">
                                <tbody>
                                <tr>
                                    <th>Type</th>
                                    <td>
                                        <?php echo $variable_0['variable_name'] ?>
                                        <input type="hidden" name="variable_0" value="<?php echo $variable_0['variable_id'] ?>" />
                                    </td>
                                </tr>
                                <tr>
                                    <th>Number of Applicant</th>
                                    <td>
                                        <?php echo $sbo_number_applicants; ?>
                                        <input type="hidden" name="sbo_number_applicants" value="<?php echo $sbo_number_applicants ?>" />
                                    </td>
                                </tr>
                                <tr>
                                    <th>Processing time</th>
                                    <td>
                                        <?php echo $variable_2['variable_name']; ?>
                                        <input type="hidden" name="variable_2" value="<?php echo $variable_2['variable_id'] ?>" />
                                    </td>
                                </tr>
                                <tr>
                                    <th>Purpose</th>
                                    <td>
                                        <?php echo $variable_1['variable_name']; ?>
                                        <input type="hidden" name="variable_1" value="<?php echo $variable_1['variable_id'] ?>" />
                                     </td>
                                </tr>
                                <tr>
                                    <th>Total Fee</th>
                                    <td>
                                        <?php echo $totalFee."USD"; ?>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
    
                    
                </div>
                <div class="marginT10">
                    <h4>1. Applicant Information</h4>
                    <?
                    for ($i = 1; $i <= $sbo_number_applicants; $i ++)
                    {
                    ?>
                    <div class="box vtns-box-blue">
                        <div class="title">
                            <h4><span class="icon16 entypo-icon-user white"></span> Applicant <?php echo $i ?></h4>
                        </div>
                        <div class="content">
                            <div class="form-row row-fluid">
                                <div class="span12">
                                    <div class="row-fluid">
                                        <label for="fullname_<?=$i?>" class="form-label span5">Fullname listed in Passport (*)</label>
                                        <input type="text" class="span7" name="fullname_<?=$i?>" id="fullname_<?=$i?>" />
                                    </div>
                                </div>
                            </div>
                            <div class="form-row row-fluid">
                                <div class="span12">
                                    <div class="row-fluid">
                                        <label for="gender_<?=$i?>" class="form-label span5">Gender</label>
                                        <select class="span7" name="gender_<?=$i?>" id="gender_<?=$i?>">
                                            <option value="0">Male</option>
                                            <option value="1">Female</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="form-row row-fluid">
                                <div class="span12">
                                    <div class="row-fluid">
                                        <label for="dayofbirth_<?=$i?>" class="form-label span5">Date of birth (*)</label>
                                        <input type="text" class="mask-date span7" name="dayofbirth_<?=$i?>" id="dayofbirth_<?=$i?>" />
                                    </div>
                                    <div class="row-fluid">
                                    	<div class="span5"></div>
                                        <span class="help-block blue span7">dd/mm/YYYY</span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-row row-fluid">
                                <div class="span12">
                                    <div class="row-fluid">
                                        <label for="passport_<?=$i?>" class="form-label span5">Passport number (*)</label>
                                        <input type="text" class="mask-passport span7" name="passport_<?=$i?>" id="passport_<?=$i?>" />
                                    </div>
                                    <div class="row-fluid">
                                    	<div class="span5"></div>
                                        <span class="help-block blue span7">A9999999</span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-row row-fluid">
                                <div class="span12">
                                    <div class="row-fluid">
                                        <label for="passport_expire_<?=$i?>" class="form-label span5">Passport Expirate Date (*)</label>
                                        <input type="text" class="mask-date span7" name="passport_expire_<?=$i?>" id="passport_expire_<?=$i?>" />
                                    </div>
                                    <div class="row-fluid">
                                    	<div class="span5"></div>
                                        <span class="help-block blue span7">dd/mm/YYYY</span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-row row-fluid">
                                <div class="span12">
                                    <div class="row-fluid">
                                        <label for="nationality_<?=$i?>" class="form-label span5">Nationality</label>
                                        <select class="span7" name="nationality_<?=$i?>" id="nationality_<?=$i?>">
                                        	<?php 
											foreach ($nations as $key=>$nation)
											{
											?>
                                            <option value="<?php echo $key; ?>"><?php echo $nation ?></option>
                                            <?
											}
											?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?
                    }
                    ?>
                </div>
                <div class="marginT10">
                    <h4>2. Request and Contact Detail</h4>
                    <div class="box vtns-box-blue">
                        <div class="title">
                            <h4><span class="icon16 entypo-icon-flight white"></span> Arrival Information</h4>
                        </div>
                        <div class="content">
                            <div class="form-row row-fluid">
                                <div class="span12">
                                    <div class="row-fluid">
                                        <label for="date_arrival" class="form-label span5">Date of arrival (*)</label>
                                        <input type="text" class="mask-date span7" name="date_arrival" id="date_arrival" />
                                    </div>
                                    <div class="row-fluid">
                                    	<div class="span5"></div>
                                        <span class="help-block blue span7">dd/mm/YYYY</span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-row row-fluid">
                                <div class="span12">
                                    <div class="row-fluid">
                                        <label for="port_arrival" class="form-label span5">Port of arrival</label>
                                        <select class="span7" name="port_arrival" id="port_arrival">
                                            <?php 
											foreach ($ports as $key=>$port)
											{
											?>
                                            <option value="<?php echo $key; ?>"><?php echo $port ?></option>
                                            <?
											}
											?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="box vtns-box-blue">
                        <div class="title">
                            <h4><span class="icon16 entypo-icon-info-circle white"></span> Your Information</h4>
                        </div>
                        <div class="content">
                            <div class="form-row row-fluid">
                                <div class="span12">
                                    <div class="row-fluid">
                                        <label for="contact_fullname" class="form-label span5">Full Name: (*)</label>
                                        <input type="text" class="span7" name="contact_fullname" id="contact_fullname" />
                                    </div>
                                </div>
                            </div>
                            <div class="form-row row-fluid">
                                <div class="span12">
                                    <div class="row-fluid">
                                        <label for="contact_email" class="form-label span5">Email: (*)</label>
                                        <input type="text" class="span7" name="contact_email" id="contact_email" />
                                    </div>
                                </div>
                            </div>
                            <div class="form-row row-fluid">
                                <div class="span12">
                                    <div class="row-fluid">
                                        <label for="contact_country" class="form-label span5">Country</label>
                                        <select class="span7" name="contact_country" id="contact_country">
                                            <?php 
											foreach ($nations as $key=>$nation)
											{
											?>
                                            <option value="<?php echo $key; ?>"><?php echo $nation ?></option>
                                            <?
											}
											?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span5"></div>
                    <div class="span7">
                        <button type="submit" class="btn btn-info">Continue</button>
                    </div>
                </div>
            </form>
            <?php
			} else if ($step == 2) {
			?>
            <div class="row-fluid">
                <div class="box vtns-box-blue">
                    <div class="title">
                        <h4><span class="icon16 entypo-icon-info-circle white"></span>Service Information</h4>
                    </div>
                    <div class="content noPad">
                        <table class="responsive table table-striped table-align-left">
                            <tbody>
                            <tr>
                                <th>Type</th>
                                <td>
                                    <?php echo $variable_0['variable_name'] ?>
                                    <input type="hidden" name="variable_0" value="<?php echo $variable_0['variable_id'] ?>" />
                                </td>
                            </tr>
                            <tr>
                                <th>Number of Applicant</th>
                                <td>
                                    <?php echo $sbo_number_applicants; ?>
                                    <input type="hidden" name="sbo_number_applicants" value="<?php echo $sbo_number_applicants ?>" />
                                </td>
                            </tr>
                            <tr>
                                <th>Processing time</th>
                                <td>
                                    <?php echo $variable_2['variable_name']; ?>
                                    <input type="hidden" name="variable_2" value="<?php echo $variable_2['variable_id'] ?>" />
                                </td>
                            </tr>
                            <tr>
                                <th>Purpose</th>
                                <td>
                                    <?php echo $variable_1['variable_name']; ?>
                                    <input type="hidden" name="variable_1" value="<?php echo $variable_1['variable_id'] ?>" />
                                 </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

                
            </div>
            <div class="row-fluid">
                <div class="box vtns-box-blue">
                    <div class="title">
                        <h4><span class="icon16 entypo-icon-info-circle white"></span>TRAVEL DETAILS</h4>
                    </div>
                    <div class="content noPad">
                        <table class="responsive table table-striped table-align-left">
                        	<tbody>
                            	<tr>
                                	<th>Customer Name</th>
                                    <td><?php echo $contact_fullname ?></td>
                                    <th>Port Arrival</th>
                                    <td><?php echo $port_arrival ?></td>
                                </tr>
                                <tr>
                                	<th>Visa type</th>
                                    <td><?php //echo  ?></td>
                                    <th>Email</th>
                                    <td><?php echo $contact_email ?></td>
                                </tr>
                                <tr>
                                	<th>Date Arrival</th>
                                    <td><?php echo $date_arrival ?></td>
                                    <th>Total visa fee</th>
                                    <td><?php echo $totalFee."USD"; ?></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="box vtns-box-blue">
                    <div class="title">
                        <h4><span class="icon16 entypo-icon-info-circle white"></span>PASSPORT DETAILS</h4>
                    </div>
                    <div class="content noPad">
                        <table class="responsive table table-striped">
                        	<thead>
                            	<tr>
                                	<th>Number</th>
                                    <th>Name in Passport</th>
                                    <th>Gender</th>
                                    <th>Date of Birth</th>
                                    <th>Passport number</th>
                                    <th>Passport Expired</th>
                                    <th>Nationality</th>
                                </tr>
                            </thead>
                            <tbody>
                            	<?php
								$count = 0;
								foreach ($customers as $customer) {
									$count ++;
								?>
                                <tr>
                                	<td><?=$count?></td>
                                    <td><?php echo $customer['fullname']?></td>
                                    <td><?php echo $customer['gender']?></td>
                                    <td><?php echo $customer['dayofbirth']?></td>
                                    <td><?php echo $customer['passport']?></td>
                                    <td><?php echo $customer['passport_expire']?></td>
                                    <td><?php echo $customer['nationality']?></td>
                                </tr>
                                <?
								}
								?>
                            </tbody>
            			</table>
                    </div>
                </div>
            </div>
            <div class="row-fluid marginB10">
            	<div class="span4"></div>
                <div class="span8">
                	<a href="#" class="btn btn-info" rel="popoverTop" data-content="Click here to pay in Onepay or Paypal" data-original-title="Notice">Pay width Credit Cards</a>
                </div>
            </div>
            <?
			}
			?>
            <div class="row-fluid marginT10">
            	<div class="span12">
                	<?php
					if (count($cms_array) > 0)
					{
						foreach ($cms_array as $cms)
						{
						?>
							<div class="marginT10">
								<h4><?php echo $cms['title'] ?></h4>
								<p>
									<?php echo htmlspecialchars_decode($cms['content']) ?>
								</p>
							</div>
						<?
						}
					}
					?>
                </div>
            </div>
            <!--END Body content-->
		</div>
		<?php include_partial("default/rightHook", array('rightBlocks' => $rightBlocks)); ?>
	  </div>
	</div>
</div>
<?php include_partial("default/menuBottom", array('menuBottoms' => $menuBottoms)); ?>
<?php include_partial("default/bottom", array('bottom' => $bottom)); ?>

<script>
	$(document).ready(function()
	{
		$("#applyForm2").validate({
			rules: {
				<?
				for ($i = 1; $i <= $sbo_number_applicants; $i ++)
				{
				?>
				fullname_<?php echo $i; ?>: "required",
				dayofbirth_<?php echo $i; ?>: {
				  required: true,
				  date: true
				},
				passport_<?php echo $i; ?>: "required",
				passport_expire_<?php echo $i; ?>: {
				  required: true,
				  date: true
				},
				<?
				}
				?>
				date_arrival: {
				  required: true,
				  date: true
				},
				contact_fullname: "required",
				contact_email: "required"
			},
			messages: {
				txt_email: "Please enter a valid email address"
			}
		});
	});
</script>